#ifndef FILE_H_
#define FILE_H_

#include <cstdlib>
#include <string>
#include <fstream>

/* A C++ Wrapper class around an input File stream Data Structure */
    
/* To Do: 
        * Error Handling 
        * Templated to allow choice of comment characters? 
*/
class File
{
public:
    /* Attempt to open the file */
	bool OpenRead(const std::string& filename);

    /* Gets a string from the file and modifies the pointer parameter 
     * Returns false if anything goes wrong 
     * currently has a default buffer size of 1000
     * currently ignores lines begines with '#' or empty lines */
    bool GetString(std::string* pStringResult);

    /* Calls Get String and converts it to an integer */
	bool GetInteger(int* pIntResult);
    /* Calls Get String and converts it to a float */
	bool GetFloat(float* pFloatResult);
    /* Closes the stream */
	void Close();
    //helper functions
    static float StoF(const std::string& s)
    {
        return (float)atof(s.c_str());
    }
    static int StoI(const std::string& s)
    {
        return atoi(s.c_str());
    }

private:
	std::ifstream m_file;
};

#endif
